 /**
 * 上海中赢金融信息服务有限公司
 * Copyright (c) 2017-2027 Chinazyjr,Inc.All Rights Reserved.
 */
package com.sys.midware.httpClient.crawler;

import org.apache.commons.lang3.StringUtils;

public enum HttpMethod {

	// http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
	HEAD("HEAD"), PUT("PUT"), GET("GET"), POST("POST"), DELETE("DELETE"), TRACE(
			"TRACE"), CONNECT("CONNECT"), OPTIONS("OPTIONS");

	private String method;

	private HttpMethod(String method) {
		this.method = method;
	}

	public static HttpMethod codeOf(String method) {
		for (HttpMethod m : HttpMethod.values()) {
			if (StringUtils.equalsIgnoreCase(m.getMethod(), method)) {
				return m;
			}
		}
		return null;
	}

	public String getMethod() {
		return method;
	}

	public void setMethod(String method) {
		this.method = method;
	}

}
